package cn.jsj.finance.bank;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 添加一条发票信息处理类
 * @author LI
 *
 */
 public class AddInvoiceInfo extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	 public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//调试信息
		 cn.jsj.utils.SysLogger.PrintInfo("添加一条发票信息！！！！！");

		 //新建发票信息对象
		 cn.jsj.pojo.TblInvoiceManage tim=new cn.jsj.pojo.TblInvoiceManage();
		 tim.setContractNumber(request.getParameter("contract").trim());
		 tim.setInvoiceMoney(Integer.parseInt(request.getParameter("Payout").trim()));
		 tim.setInvoicePerson(request.getParameter("invoicePer").trim());
		 tim.setInvoiceRemark(request.getParameter("invoiceBrief").trim().replaceAll("\n", "，"));
		 tim.setInvoiceTime(cn.jsj.utils.TimeDispose.transferDate(request.getParameter("invoiceAccTime".trim())));
		 tim.setInvoiceNumber(request.getParameter("invoiceId").trim());

		 //保存发票信息
		 cn.jsj.dao.TblInvoiceManageDAO timd=new cn.jsj.dao.TblInvoiceManageDAO();
		 int saveResult=timd.saveInvoiceInfo(tim);

		 //输出流
		 java.io.PrintWriter out=response.getWriter();

		 if(saveResult==1){
			 out.println("{message:'保存成功！'}");

		 }else{
			 out.println("{message:'保存失败！'}");
		 }
		 out.flush();
		 out.close();
	 }
}